package org.youyee.game.managers
{
	import org.youyee.game.object.MapObject;
	import org.youyee.game.pathFinding.PathNode;

	/**
	 * 一个移动的项目 
	 * @author youyeelu
	 * 
	 */	
	public class MoveParameter
	{
		/**
		 * 路径索引 
		 */		
		public var index:int;
		
		/**
		 * 路径 
		 */		
		public var path:Array;
		
		/**
		 * 移动的物体 
		 */		
		public var object:MapObject;
		
		/**
		 * 到达节点时的回调 
		 */		
		public var onPathNodeHandler:Function;
		
		/**
		 * 到达终点时的回调 
		 */		
		public var arrivedHandler:Function;
		
		/**
		 * 准备前往某个节点的回调
		 */		
		public var prepareToHandler:Function;
		
		/**
		 * 目标位置 
		 */		
		public var targetPathNode:PathNode;
		
		/**
		 * 构造函数 
		 * @param object 需要被控制的物体
		 * @param targetPathNode 目标的位置
		 * @param onPathNodeHandler 到达节点时的回调 
		 * @param arrivedHandler 到达终点时的回调 
		 * @param prepareToHandler 准备前往某个节点的回调
		 * 
		 */		
		public function MoveParameter(object:MapObject, targetPathNode:PathNode, onPathNodeHandler:Function=null, arrivedHandler:Function=null, prepareToHandler:Function=null)
		{
			this.object = object;
			this.targetPathNode = targetPathNode;
			this.onPathNodeHandler = onPathNodeHandler;
			this.arrivedHandler = arrivedHandler;
			this.prepareToHandler = prepareToHandler;
		}
		
		/**
		 * 销毁项目 
		 * 
		 */		
		public function destroy():void
		{
			this.index = 0;
			this.path = null;
			this.object = null;
			this.onPathNodeHandler = null;
			this.arrivedHandler = null;
			this.targetPathNode = null;
		}
	}
}